/ Assembly List / LJCNetCommon / NetCommon / GetDecimal

Namespace - LJCNetCommon


Parameters
value - The value object.

Returns

The decimal value or zero if the object is null. Also returns zero if the object is not type "decimal", "long", "int" or "short".

Syntax

C#
public static Decimal GetDecimal(Object value)

Gets a decimal value from an object. (E)

Example

C#
using LJCNetCommon;
        
// Gets a decimal value from an object.
private static void GetDecimal()
{
    // Simulates an Object value like that received from a DataTable.
    decimal setup = 3.14m;
    object obj = setup;

    // Gets a decimal value from an object.
    decimal value = NetCommon.GetDecimal(obj);
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.